package yana.tpe.shop.domain.domains;

import java.io.Serializable;


public class TradeElement implements Serializable {

    private Product product;
    private double amount;

    public TradeElement() {
    }

    public TradeElement(Product product, double amount) {
        this.product = product;
        this.amount = amount;
    }

    public double getAmount() {
        return amount;
    }

    public void setAmount(double amount) {
        this.amount = amount;
    }

    public Product getProduct() {
        return product;
    }

    public void setProduct(Product product) {
        this.product = product;
    }

    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final TradeElement other = (TradeElement) obj;
        if (this.product != other.product && (this.product == null || !this.product.equals(other.product))) {
            return false;
        }
        if (Double.doubleToLongBits(this.amount) != Double.doubleToLongBits(other.amount)) {
            return false;
        }
        return true;
    }

    public int hashCode() {
        int hash = 7;
        hash = 89 * hash + (this.product != null ? this.product.hashCode() : 0);
        hash = 89 * hash + (int) (Double.doubleToLongBits(this.amount) ^ (Double.doubleToLongBits(this.amount) >>> 32));
        return hash;
    }

    @Override
    public String toString() {
        return "TradeElement{" + "product=" + product + ", amount=" + amount + '}';
    }
}
